#pragma once
struct IDirect3DVertexBuffer9;
struct IDirect3DIndexBuffer9;

//
// VertexData
//
class VertexData
{
public:
	struct StreamInfo
	{
		UINT StreamNumber;
		IDirect3DVertexBuffer9* pStreamData;
		UINT OffsetInBytes;
		UINT Stride;

		StreamInfo() : pStreamData(NULL) {}
		StreamInfo(UINT streamNumber, IDirect3DVertexBuffer9* streamData, UINT offsetInBytes, UINT stride)
			: StreamNumber(streamNumber), pStreamData(streamData), OffsetInBytes(offsetInBytes), Stride(stride)
		{}
	};

private:
	VertexData(const VertexData& rhs);
	VertexData& operator=(const VertexData& rhs);

public:
	VertexData() {}
	VertexData(const StreamInfo& pVB, const StreamInfo& npVB);
	~VertexData();
	
	inline const StreamInfo& getPositionStreamInfo() const { return mPositionStreamInfo; }
	inline const StreamInfo& getNoPositionStreamInfo() const { return mNoPositionStreamInfo; }

	void Set(bool positionOnly) const;

private:
	StreamInfo mPositionStreamInfo;
	StreamInfo mNoPositionStreamInfo;
};

//
// IndexData
//
class IndexData
{
public:
	struct PrimitiveInfo
	{
		BYTE PrimitiveType;
		INT BaseVertexIndex;
		UINT MinVertexIndex;
		UINT NumVertices;
		UINT StartIndex;
		UINT PrimCount;
	};

private:
	IndexData(const IndexData& rhs);
	IndexData& operator=(const IndexData& rhs);

public:
	IndexData();
	IndexData(IDirect3DIndexBuffer9* pIB, const PrimitiveInfo& primitiveInfo);
	~IndexData();

	IDirect3DIndexBuffer9* getIndexBuffer() const { return mIndexBuffer; }
	const PrimitiveInfo& getPrimitiveInfo() const { return mPrimitiveInfo; }

private:
	IDirect3DIndexBuffer9* mIndexBuffer;
	PrimitiveInfo mPrimitiveInfo;
};
